import request from '/@/utils/request';

/**
 *  数据管理
 */

//---- 年份酒数据 -----
// 列表
export const fetchInventoryList = (data?: any) => {
	return request({
		url: '/data/otbInventoryList',
		method: 'post',
		data,
	});
};

// 导出
export const fetchInventoryExport = (data: any) => {
	return request({
		url: '/data/otbInventoryListExport',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// B2C商品分析
export const fetchDataB2cGoods = (data: any) => {
	return request({
		url: '/data/b2cGoods',
		method: 'post',
		data,
	});
};

// 商品图表排行
export const fetchChartExport = (data: any) => {
	return request({
		url: '/data/b2cGoodsExport',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// 商品销售排行
export const fetchDataGoodsRankList = (data: any) => {
	return request({
		url: '/data/goodsRankList',
		method: 'post',
		data,
	});
};

// 分类销售排行
export const fetchDataCatRankList = (data: any) => {
	return request({
		url: '/data/catRankList',
		method: 'post',
		data,
	});
};

// 导出商品图表排行
export const fetchCatRankListExport = (data: any) => {
	return request({
		url: '/data/catRankListExport',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// 商品图表排行
export const fetchGoodsRankListExport = (data: any) => {
	return request({
		url: '/data/goodsRankListExport',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// 用户分析报表
export const fetchDataUserData = (data: any) => {
	return request({
		url: '/data/userData',
		method: 'post',
		data,
	});
};

// 用户分析报表导出
export const fetchUserDataExport = (data: any) => {
	return request({
		url: '/data/userDataExport',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// 用户支付分析
export const fetchDataUserDataRate = (data: any) => {
	return request({
		url: '/data/userDataRate',
		method: 'post',
		data,
	});
};

// 年份酒库存-筛选下拉列表
export const fetchNfjCategory = (data: any) => {
	return request({
		url: '/data/nfjCategory',
		method: 'post',
		data,
	});
};

// 年份酒库存
export const fetchNfjInventory = (data: any) => {
	return request({
		url: '/data/nfjInventory',
		method: 'post',
		data,
	});
};

// 导出
export const fetchNfjInventoryExport = (data: any) => {
	return request({
		url: '/data/nfjInventoryExport',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// 年份酒库存-生产批次数据
export const fetchNfjBatch = (data: any) => {
	return request({
		url: '/data/nfjBatch',
		method: 'post',
		data,
	});
};

// 年份酒价值概况
export const fetchNfjValue = (data: any) => {
	return request({
		url: '/data/nfjValue',
		method: 'post',
		data,
	});
};

// 年份酒价值趋势
export const fetchNfjValueCharts = (data: any) => {
	return request({
		url: '/data/nfjValueCharts',
		method: 'post',
		data,
	});
};

// 年份酒价值趋势导出
export const fetchNfjValueChartsExport = (data: any) => {
	return request({
		url: '/data/nfjValueChartsExport',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// 年份酒价值明细
export const fetchNfjValueList = (data: any) => {
	return request({
		url: 'data/nfjValueList',
		method: 'post',
		data,
	});
};

// 年份酒价值趋势导出
export const fetchNfjValueListExport = (data: any) => {
	return request({
		url: '/data/nfjValueListExport',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// 商城交易分析-交易概况
export const fetchB2cOrder = (data: any) => {
	return request({
		url: '/data/b2cOrder',
		method: 'post',
		data,
	});
};
// 商城交易分析-交易概况导出
export const fetchB2cOrderExport = (data: any) => {
	return request({
		url: '/data/b2cOrderExport',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// 商城交易分析-交易构成
export const fetchB2cOrderAmount = (data: any) => {
	return request({
		url: '/data/b2cOrderAmount',
		method: 'post',
		data,
	});
};

// c2c集市分析
export const fetchC2cMarket = (data: any) => {
	return request({
		url: 'data/c2cMarket',
		method: 'post',
		data,
	});
};

// 导出
export const fetchC2cMarketExport = (data: any) => {
	return request({
		url: '/data/c2cMarketExport',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// 构成
export const fetchC2cOrderAmount = (data: any) => {
	return request({
		url: 'data/c2cOrderAmount',
		method: 'post',
		data,
	});
};

// c2c酒藏分析
export const fetchC2cGoods = (data: any) => {
	return request({
		url: 'data/c2cGoods',
		method: 'post',
		data,
	});
};

// 导出
export const fetchC2cGoodsExport = (data: any) => {
	return request({
		url: '/data/c2cGoodsExport',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// 商品销售排行
export const fetchC2cGoodsRankList = (data: any) => {
	return request({
		url: 'data/c2cGoodsRankList',
		method: 'post',
		data,
	});
};

// 商品销售排行导出
export const fetchC2cGoodsRankListExport = (data: any) => {
	return request({
		url: '/data/c2cGoodsRankListExport',
		method: 'post',
		responseType: 'blob',
		data,
	});
};

// 获取枚举
export const fetcDataEnums = (type: string, params?: object) => {
	return request({
		url: `/data/nfj/${type}/year`,
		method: 'get',
		params,
	});
};
